\(\int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx\) [124]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [F(-2)]
   Mupad [F(-1)]

Optimal result

Integrand size = 23, antiderivative size = 83 \[ \int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx=-\frac {\sqrt {b} \arctan \left (\frac {\sqrt {b} \cos (e+f x)}{\sqrt {a+b-b \cos ^2(e+f x)}}\right )}{f}-\frac {\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {a+b-b \cos ^2(e+f x)}}\right )}{f} \]

[Out]

-arctanh(cos(f*x+e)*a^(1/2)/(a+b-b*cos(f*x+e)^2)^(1/2))*a^(1/2)/f-arctan(cos(f*x+e)*b^(1/2)/(a+b-b*cos(f*x+e)^
2)^(1/2))*b^(1/2)/f

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3265, 399, 223, 209, 385, 212} \[ \int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx=-\frac {\sqrt {b} \arctan \left (\frac {\sqrt {b} \cos (e+f x)}{\sqrt {a-b \cos ^2(e+f x)+b}}\right )}{f}-\frac {\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {a-b \cos ^2(e+f x)+b}}\right )}{f} \]

[In]

Int[Csc[e + f*x]*Sqrt[a + b*Sin[e + f*x]^2],x]

[Out]

-((Sqrt[b]*ArcTan[(Sqrt[b]*Cos[e + f*x])/Sqrt[a + b - b*Cos[e + f*x]^2]])/f) - (Sqrt[a]*ArcTanh[(Sqrt[a]*Cos[e
 + f*x])/Sqrt[a + b - b*Cos[e + f*x]^2]])/f

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 223

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a,
b}, x] &&  !GtQ[a, 0]

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Subst[Int[1/(c - (b*c - a*d)*x^n), x]
, x, x/(a + b*x^n)^(1/n)] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && EqQ[n*p + 1, 0] && IntegerQ[n]

Rule 399

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Dist[b/d, Int[(a + b*x^n)^(p - 1), x]
, x] - Dist[(b*c - a*d)/d, Int[(a + b*x^n)^(p - 1)/(c + d*x^n), x], x] /; FreeQ[{a, b, c, d, p}, x] && NeQ[b*c
 - a*d, 0] && EqQ[n*(p - 1) + 1, 0] && IntegerQ[n]

Rule 3265

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Cos[e + f*x], x]}, Dist[-ff/f, Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b - b*ff^2*x^2)^p, x], x, Cos
[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {\sqrt {a+b-b x^2}}{1-x^2} \, dx,x,\cos (e+f x)\right )}{f} \\ & = -\frac {a \text {Subst}\left (\int \frac {1}{\left (1-x^2\right ) \sqrt {a+b-b x^2}} \, dx,x,\cos (e+f x)\right )}{f}-\frac {b \text {Subst}\left (\int \frac {1}{\sqrt {a+b-b x^2}} \, dx,x,\cos (e+f x)\right )}{f} \\ & = -\frac {a \text {Subst}\left (\int \frac {1}{1-a x^2} \, dx,x,\frac {\cos (e+f x)}{\sqrt {a+b-b \cos ^2(e+f x)}}\right )}{f}-\frac {b \text {Subst}\left (\int \frac {1}{1+b x^2} \, dx,x,\frac {\cos (e+f x)}{\sqrt {a+b-b \cos ^2(e+f x)}}\right )}{f} \\ & = -\frac {\sqrt {b} \arctan \left (\frac {\sqrt {b} \cos (e+f x)}{\sqrt {a+b-b \cos ^2(e+f x)}}\right )}{f}-\frac {\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {a+b-b \cos ^2(e+f x)}}\right )}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.20 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.19 \[ \int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx=\frac {-\sqrt {a} \text {arctanh}\left (\frac {\sqrt {2} \sqrt {a} \cos (e+f x)}{\sqrt {2 a+b-b \cos (2 (e+f x))}}\right )+\sqrt {-b} \log \left (\sqrt {2} \sqrt {-b} \cos (e+f x)+\sqrt {2 a+b-b \cos (2 (e+f x))}\right )}{f} \]

[In]

Integrate[Csc[e + f*x]*Sqrt[a + b*Sin[e + f*x]^2],x]

[Out]

(-(Sqrt[a]*ArcTanh[(Sqrt[2]*Sqrt[a]*Cos[e + f*x])/Sqrt[2*a + b - b*Cos[2*(e + f*x)]]]) + Sqrt[-b]*Log[Sqrt[2]*
Sqrt[-b]*Cos[e + f*x] + Sqrt[2*a + b - b*Cos[2*(e + f*x)]]])/f

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(173\) vs. \(2(71)=142\).

Time = 1.01 (sec) , antiderivative size = 174, normalized size of antiderivative = 2.10

method result size
default \(\frac {\sqrt {\left (\cos ^{2}\left (f x +e \right )\right ) \left (a +b \left (\sin ^{2}\left (f x +e \right )\right )\right )}\, \left (\sqrt {b}\, \arctan \left (\frac {-2 b \left (\cos ^{2}\left (f x +e \right )\right )+a +b}{2 \sqrt {b}\, \sqrt {-b \left (\cos ^{4}\left (f x +e \right )\right )+\left (a +b \right ) \left (\cos ^{2}\left (f x +e \right )\right )}}\right )-\sqrt {a}\, \ln \left (\frac {-\left (a -b \right ) \left (\cos ^{2}\left (f x +e \right )\right )-2 \sqrt {a}\, \sqrt {-b \left (\cos ^{4}\left (f x +e \right )\right )+\left (a +b \right ) \left (\cos ^{2}\left (f x +e \right )\right )}-a -b}{\cos ^{2}\left (f x +e \right )-1}\right )\right )}{2 \cos \left (f x +e \right ) \sqrt {a +b \left (\sin ^{2}\left (f x +e \right )\right )}\, f}\) \(174\)

[In]

int(csc(f*x+e)*(a+b*sin(f*x+e)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/2*(cos(f*x+e)^2*(a+b*sin(f*x+e)^2))^(1/2)*(b^(1/2)*arctan(1/2*(-2*b*cos(f*x+e)^2+a+b)/b^(1/2)/(-b*cos(f*x+e)
^4+(a+b)*cos(f*x+e)^2)^(1/2))-a^(1/2)*ln((-(a-b)*cos(f*x+e)^2-2*a^(1/2)*(-b*cos(f*x+e)^4+(a+b)*cos(f*x+e)^2)^(
1/2)-a-b)/(cos(f*x+e)^2-1)))/cos(f*x+e)/(a+b*sin(f*x+e)^2)^(1/2)/f

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 207 vs. \(2 (71) = 142\).

Time = 0.48 (sec) , antiderivative size = 1158, normalized size of antiderivative = 13.95 \[ \int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx=\text {Too large to display} \]

[In]

integrate(csc(f*x+e)*(a+b*sin(f*x+e)^2)^(1/2),x, algorithm="fricas")

[Out]

[1/8*(sqrt(-b)*log(128*b^4*cos(f*x + e)^8 - 256*(a*b^3 + b^4)*cos(f*x + e)^6 + 160*(a^2*b^2 + 2*a*b^3 + b^4)*c
os(f*x + e)^4 + a^4 + 4*a^3*b + 6*a^2*b^2 + 4*a*b^3 + b^4 - 32*(a^3*b + 3*a^2*b^2 + 3*a*b^3 + b^4)*cos(f*x + e
)^2 - 8*(16*b^3*cos(f*x + e)^7 - 24*(a*b^2 + b^3)*cos(f*x + e)^5 + 10*(a^2*b + 2*a*b^2 + b^3)*cos(f*x + e)^3 -
 (a^3 + 3*a^2*b + 3*a*b^2 + b^3)*cos(f*x + e))*sqrt(-b*cos(f*x + e)^2 + a + b)*sqrt(-b)) + 2*sqrt(a)*log(2*((a
^2 - 6*a*b + b^2)*cos(f*x + e)^4 + 2*(3*a^2 + 2*a*b - b^2)*cos(f*x + e)^2 - 4*((a - b)*cos(f*x + e)^3 + (a + b
)*cos(f*x + e))*sqrt(-b*cos(f*x + e)^2 + a + b)*sqrt(a) + a^2 + 2*a*b + b^2)/(cos(f*x + e)^4 - 2*cos(f*x + e)^
2 + 1)))/f, 1/8*(4*sqrt(-a)*arctan(-1/2*((a - b)*cos(f*x + e)^2 + a + b)*sqrt(-b*cos(f*x + e)^2 + a + b)*sqrt(
-a)/(a*b*cos(f*x + e)^3 - (a^2 + a*b)*cos(f*x + e))) + sqrt(-b)*log(128*b^4*cos(f*x + e)^8 - 256*(a*b^3 + b^4)
*cos(f*x + e)^6 + 160*(a^2*b^2 + 2*a*b^3 + b^4)*cos(f*x + e)^4 + a^4 + 4*a^3*b + 6*a^2*b^2 + 4*a*b^3 + b^4 - 3
2*(a^3*b + 3*a^2*b^2 + 3*a*b^3 + b^4)*cos(f*x + e)^2 - 8*(16*b^3*cos(f*x + e)^7 - 24*(a*b^2 + b^3)*cos(f*x + e
)^5 + 10*(a^2*b + 2*a*b^2 + b^3)*cos(f*x + e)^3 - (a^3 + 3*a^2*b + 3*a*b^2 + b^3)*cos(f*x + e))*sqrt(-b*cos(f*
x + e)^2 + a + b)*sqrt(-b)))/f, 1/4*(sqrt(b)*arctan(1/4*(8*b^2*cos(f*x + e)^4 - 8*(a*b + b^2)*cos(f*x + e)^2 +
 a^2 + 2*a*b + b^2)*sqrt(-b*cos(f*x + e)^2 + a + b)*sqrt(b)/(2*b^3*cos(f*x + e)^5 - 3*(a*b^2 + b^3)*cos(f*x +
e)^3 + (a^2*b + 2*a*b^2 + b^3)*cos(f*x + e))) + sqrt(a)*log(2*((a^2 - 6*a*b + b^2)*cos(f*x + e)^4 + 2*(3*a^2 +
 2*a*b - b^2)*cos(f*x + e)^2 - 4*((a - b)*cos(f*x + e)^3 + (a + b)*cos(f*x + e))*sqrt(-b*cos(f*x + e)^2 + a +
b)*sqrt(a) + a^2 + 2*a*b + b^2)/(cos(f*x + e)^4 - 2*cos(f*x + e)^2 + 1)))/f, 1/4*(2*sqrt(-a)*arctan(-1/2*((a -
 b)*cos(f*x + e)^2 + a + b)*sqrt(-b*cos(f*x + e)^2 + a + b)*sqrt(-a)/(a*b*cos(f*x + e)^3 - (a^2 + a*b)*cos(f*x
 + e))) + sqrt(b)*arctan(1/4*(8*b^2*cos(f*x + e)^4 - 8*(a*b + b^2)*cos(f*x + e)^2 + a^2 + 2*a*b + b^2)*sqrt(-b
*cos(f*x + e)^2 + a + b)*sqrt(b)/(2*b^3*cos(f*x + e)^5 - 3*(a*b^2 + b^3)*cos(f*x + e)^3 + (a^2*b + 2*a*b^2 + b
^3)*cos(f*x + e))))/f]

Sympy [F]

\[ \int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx=\int \sqrt {a + b \sin ^{2}{\left (e + f x \right )}} \csc {\left (e + f x \right )}\, dx \]

[In]

integrate(csc(f*x+e)*(a+b*sin(f*x+e)**2)**(1/2),x)

[Out]

Integral(sqrt(a + b*sin(e + f*x)**2)*csc(e + f*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 132, normalized size of antiderivative = 1.59 \[ \int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx=-\frac {2 \, \sqrt {b} \arcsin \left (\frac {b \cos \left (f x + e\right )}{\sqrt {a b + b^{2}}}\right ) + \sqrt {a} \log \left (b - \frac {\sqrt {-b \cos \left (f x + e\right )^{2} + a + b} \sqrt {a}}{\cos \left (f x + e\right ) - 1} - \frac {a}{\cos \left (f x + e\right ) - 1}\right ) - \sqrt {a} \log \left (-b + \frac {\sqrt {-b \cos \left (f x + e\right )^{2} + a + b} \sqrt {a}}{\cos \left (f x + e\right ) + 1} + \frac {a}{\cos \left (f x + e\right ) + 1}\right )}{2 \, f} \]

[In]

integrate(csc(f*x+e)*(a+b*sin(f*x+e)^2)^(1/2),x, algorithm="maxima")

[Out]

-1/2*(2*sqrt(b)*arcsin(b*cos(f*x + e)/sqrt(a*b + b^2)) + sqrt(a)*log(b - sqrt(-b*cos(f*x + e)^2 + a + b)*sqrt(
a)/(cos(f*x + e) - 1) - a/(cos(f*x + e) - 1)) - sqrt(a)*log(-b + sqrt(-b*cos(f*x + e)^2 + a + b)*sqrt(a)/(cos(
f*x + e) + 1) + a/(cos(f*x + e) + 1)))/f

Giac [F(-2)]

Exception generated. \[ \int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx=\text {Exception raised: TypeError} \]

[In]

integrate(csc(f*x+e)*(a+b*sin(f*x+e)^2)^(1/2),x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Error: Bad Argument Type

Mupad [F(-1)]

Timed out. \[ \int \csc (e+f x) \sqrt {a+b \sin ^2(e+f x)} \, dx=\int \frac {\sqrt {b\,{\sin \left (e+f\,x\right )}^2+a}}{\sin \left (e+f\,x\right )} \,d x \]

[In]

int((a + b*sin(e + f*x)^2)^(1/2)/sin(e + f*x),x)

[Out]

int((a + b*sin(e + f*x)^2)^(1/2)/sin(e + f*x), x)